﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
//using System.Xml.Linq;
using System.Collections.Generic;

using YouHP.BLL;
using YouHP.Model;
using YouHP.Model.Group;
using YouHP.Utility;
namespace web.admin
{
    public partial class BulletinListAdd : System.Web.UI.Page
    {
        private NewsInfoBLL newsBll = NewsInfoBLL.Instance;
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void CancelButton_click(object sender, EventArgs e)
        {

        }
        protected void InsertButton_click(object sender, EventArgs e)
        {
            NewsInfo info = validateForm(this.newsInfo);

            if (info != null)
            {
                if (newsBll.AddNews(info))
                {
                    Response.Redirect("BulletinList.aspx");
                }
            }

        }
        protected void DataBound(object sender, EventArgs e)
        {

        }
        private NewsInfo validateForm(DetailsView formViewCtl)
        {
            NewsInfo info = new NewsInfo();

            //info.IsNews = Convert.ToInt32(this.GroupId.Text);
            info.Title = ((TextBox)formViewCtl.FindControl("title")).Text;
            info.IsNews = false ;
            info.Brif = ((TextBox)formViewCtl.FindControl("introduction")).Text;
            info.CreateTime = DateTime.Now;
            info.LastUpdateTime = DateTime.Now;

            info.Body = ((TextBox)formViewCtl.FindControl("body")).Text;


            return info;
        }
    }
}
